package utility;

import java.awt.Graphics;
import javax.swing.ImageIcon;

/**
 *
 * @author Jeppe
 */
public class Ja_Nej_Dialog extends javax.swing.JDialog {

    private final ConfirmDialog confirmDialog;

   /**
    * Creates new form Ok_CancelDialog
    * @param parent
    * @param modal
    * @param str
    * @param titel
    * @param confirmDialog 
    */
    public Ja_Nej_Dialog(java.awt.Frame parent, boolean modal, String str, String titel, ConfirmDialog confirmDialog) {
        super(parent, modal);
        initComponents();
        setTitle(titel);
        strLabel.setText(str);
        this.confirmDialog = confirmDialog;
        setLocationRelativeTo(parent);
        setSize(327, 229);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        strLabel = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel(){
            public void paint(Graphics g){
                ImageToolbox.drawImage(g, (ImageIcon)jLabel1.getIcon(), 0, 0, jLabel1.getWidth(), jLabel1.getHeight());
            }
        };

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setLocationByPlatform(true);
        setResizable(false);
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentHidden(java.awt.event.ComponentEvent evt) {
                formComponentHidden(evt);
            }
        });
        getContentPane().setLayout(null);

        jButton1.setText("Nej");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1);
        jButton1.setBounds(205, 125, 80, 52);

        jButton2.setText("Ja");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton2);
        jButton2.setBounds(45, 125, 80, 52);

        strLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        getContentPane().add(strLabel);
        strLabel.setBounds(10, 46, 307, 30);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/baggrund.png"))); // NOI18N
        getContentPane().add(jLabel1);
        jLabel1.setBounds(0, 0, 330, 230);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        confirmDialog.setJa_Nej(true);
        setVisible(false);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        confirmDialog.setJa_Nej(false);
        setVisible(false);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void formComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentHidden
        confirmDialog.setJa_Nej(false);        
    }//GEN-LAST:event_formComponentHidden


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel strLabel;
    // End of variables declaration//GEN-END:variables
}
